package bairui.international.model.domain.jpa;

import bairui.international.model.domain.jpa.TBSuper_StateVerifyRecord;

/**
 *
 * (电子券状态)TB_ElectronicTicketStateRecord
 *
 * @说明
 * <pre>

 * </pre>
 *
 * @see Help_TB_ElectronicTicketStateRecord#inheritance() 继承体系信息
 *
 */
@org.hibernate.annotations.DynamicInsert
@org.hibernate.annotations.DynamicUpdate

@javax.persistence.Entity(name="t_electronicTicketStateRecord")
@com.lianjing.sh.processing.info.annotation.GenerateInfoModel
@SuppressWarnings("serial")
@com.lianjing.sh.model.common.annotation.Comment("电子券状态")
@com.lianjing.sh.processing.info.annotation.InfoComment("电子券状态")
public class TB_ElectronicTicketStateRecord
 extends TBSuper_StateVerifyRecord
 implements 
	com.lianjing.sh.model.common.stardard.TableModel<Long>,
	java.io.Serializable

{

	
	
	/**
	 * 必须属性赋值接口
	 */
	public static interface MustProperties{
		/** 类型 */
		public bairui.international.model.type.Type_StateRecord getType();
		/** 说明 */
		public String getCommentate();
		/** 电子券 */
		public bairui.international.model.domain.jpa.TB_ElectronicTicket getElectronicTicket();
	}
	
	/**
	 * 为必须属性赋值
	 */
	public TB_ElectronicTicketStateRecord properties(MustProperties properties) {
		this.setType(properties.getType());
		this.setCommentate(properties.getCommentate());
		this.setElectronicTicket(properties.getElectronicTicket());
		return this;
	}
	
	/**
	 *	必须属性构造函数
	 */
	public TB_ElectronicTicketStateRecord(MustProperties properties) {
		this.properties(properties);
	}
	
	
	/**
	 * 可选单属性赋值接口
	 */
	public static interface OptionalSingleProperties{
		/** 消息 */
		public String getMessage();
	}
	
	/**
	 * 为可选单属性赋值
	 */
	public TB_ElectronicTicketStateRecord properties(OptionalSingleProperties properties) {
		this.setMessage(properties.getMessage());
		return this;
	}
	
	
	
	public TB_ElectronicTicketStateRecord(MustProperties must, OptionalSingleProperties optionalSingle) {
		this.properties(must);
		this.properties(optionalSingle);
	}
	
	/**
	 * 仅当前必须属性赋值接口
	 */
	public static interface CurrentMustProperties{
		/** 电子券 */
		public bairui.international.model.domain.jpa.TB_ElectronicTicket getElectronicTicket();
	}
	
	/**
	 * 为仅当前必须属性赋值
	 */
	public TB_ElectronicTicketStateRecord properties(CurrentMustProperties properties) {
		this.setElectronicTicket(properties.getElectronicTicket());
		return this;
	}
	
	/**
	 * 仅当前可选单属性赋值接口
	 */
	public static interface CurrentOptionalSingleProperties{
	}
	
	/**
	 * 为仅当前可选单属性赋值
	 */
	public TB_ElectronicTicketStateRecord properties(CurrentOptionalSingleProperties properties) {
		return this;
	}
	
	public TB_ElectronicTicketStateRecord(
		@lombok.NonNull bairui.international.model.domain.jpa.TBSuper_StateVerifyRecord bean,
		CurrentMustProperties mustProperties,
		CurrentOptionalSingleProperties optionalProperties
	) {
		this(bean);
		this.properties(mustProperties);
		this.properties(optionalProperties);
	}
	
	public TB_ElectronicTicketStateRecord(
		@lombok.NonNull bairui.international.model.domain.jpa.TBSuper_StateVerifyRecord bean
	) {
		update(bean);
	}
	
	public TB_ElectronicTicketStateRecord update(bairui.international.model.domain.jpa.TBSuper_StateVerifyRecord bean){
		this.setId(bean.getId());
		this.setMessage(bean.getMessage());
		this.setType(bean.getType());
		this.setCommentate(bean.getCommentate());
		this.setCreateTime(bean.getCreateTime());
		return this;
	}
	
	
	/**
	 * 更新属性内部类
	 */
	public abstract class UpdateProperties {
	
		public UpdateProperties() throws Exception {
			String message = getMessage(TB_ElectronicTicketStateRecord.this);
			if(isOverride_getMessage){
				TB_ElectronicTicketStateRecord.this.setMessage(message);
			}
	
			bairui.international.model.type.Type_StateRecord type = getType(TB_ElectronicTicketStateRecord.this);
			if(isOverride_getType){
				TB_ElectronicTicketStateRecord.this.setType(type);
			}
	
			String commentate = getCommentate(TB_ElectronicTicketStateRecord.this);
			if(isOverride_getCommentate){
				TB_ElectronicTicketStateRecord.this.setCommentate(commentate);
			}
	
			bairui.international.model.domain.jpa.TB_ElectronicTicket electronicTicket = getElectronicTicket(TB_ElectronicTicketStateRecord.this);
			if(isOverride_getElectronicTicket){
				TB_ElectronicTicketStateRecord.this.setElectronicTicket(electronicTicket);
			}
		}
	
		public TB_ElectronicTicketStateRecord up(){
			return TB_ElectronicTicketStateRecord.this;
		}
	
		/** 消息 */
		private boolean isOverride_getMessage = true;
		public String getMessage(TB_ElectronicTicketStateRecord it) throws Exception { 
			isOverride_getMessage = false; 
			return null;
		}
		/** 类型 */
		private boolean isOverride_getType = true;
		public bairui.international.model.type.Type_StateRecord getType(TB_ElectronicTicketStateRecord it) throws Exception { 
			isOverride_getType = false; 
			return null;
		}
		/** 说明 */
		private boolean isOverride_getCommentate = true;
		public String getCommentate(TB_ElectronicTicketStateRecord it) throws Exception { 
			isOverride_getCommentate = false; 
			return null;
		}
		/** 电子券 */
		private boolean isOverride_getElectronicTicket = true;
		public bairui.international.model.domain.jpa.TB_ElectronicTicket getElectronicTicket(TB_ElectronicTicketStateRecord it) throws Exception { 
			isOverride_getElectronicTicket = false; 
			return null;
		}
	
	}
	
	
	/**
	 * 构造函数
	 */
	public TB_ElectronicTicketStateRecord() {
	}
	
	public TB_ElectronicTicketStateRecord(
		@lombok.NonNull Long id
	) {
		this.setId(id);
	}
	
	public TB_ElectronicTicketStateRecord(
		@lombok.NonNull TB_ElectronicTicketStateRecord bean
	) {
		this.setId(bean.getId());
		this.setMessage(bean.getMessage());
		this.setType(bean.getType());
		this.setCommentate(bean.getCommentate());
		this.setCreateTime(bean.getCreateTime());
		this.setElectronicTicket(bean.getElectronicTicket());
	}
	
	

	


	/**
	 * 属性
	 */
	@com.lianjing.sh.model.common.annotation.Comment("电子券")
	@com.lianjing.sh.processing.info.annotation.InfoComment("电子券")
	@com.querydsl.core.annotations.QueryInit("*.*.*")
	@javax.persistence.ManyToOne(optional=false)
	private bairui.international.model.domain.jpa.TB_ElectronicTicket electronicTicket;

	/** get[电子券] */
	public bairui.international.model.domain.jpa.TB_ElectronicTicket getElectronicTicket() {
		return this.electronicTicket;
	}

	/** set[电子券] */
	public void setElectronicTicket(bairui.international.model.domain.jpa.TB_ElectronicTicket electronicTicket) {
		this.electronicTicket = electronicTicket;
	}

	public void assignElectronicTicket(bairui.international.model.domain.jpa.TB_ElectronicTicket electronicTicket) {
		if(null != electronicTicket){
			electronicTicket.addElectronicTicketStateRecords(this);
		}
		this.setElectronicTicket(electronicTicket);
	}
	

	
	
	

	/** take[电子券] */
	public bairui.international.model.domain.jpa.TB_ElectronicTicket takeElectronicTicket(){
		if(null == this.electronicTicket){
			this.electronicTicket = new bairui.international.model.domain.jpa.TB_ElectronicTicket();
		}
		return this.electronicTicket;
	}
	
	/** must[电子券] */
	public bairui.international.model.domain.jpa.TB_ElectronicTicket mustElectronicTicket() {
		return this.electronicTicket;
	}
	
	

	/**
	 * 复写 hashCode
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		return prime * result + ((this.getId() == null) ? 0 : this.getId().hashCode());
	}
	
	/**
	 * 复写 equals
	 */
	@Override
	public boolean equals(Object obj) {
		if (this == obj){
			return true;
		}
		if (obj == null){
			return false;
		}
		if (getClass() != obj.getClass()){
			return false;
		}
		TB_ElectronicTicketStateRecord other = (TB_ElectronicTicketStateRecord) obj;
		if (this.getId() == null) {
			return false;
		} else if (!this.getId().equals(other.getId())){
			return false;
		}
		return true;
	}
	

	/**
	 * 用来覆盖toString()的输出
	 */
	@javax.persistence.Transient
	private String toString;
	
	public void setToString(String toString) {
		this.toString = toString;
	}
	
	/**
	 * 复写 toString
	 */
	@Override
	public String toString() {
		if(null != this.toString){
			return this.toString;
		}
		return super.toString();
	}	

	@javax.persistence.PrePersist
	public void prePersist() {
		this.setCreateTime(new java.util.Date());
	}
	
	@javax.persistence.PreUpdate
	public void preUpdate() {
	}



}
